 $ type satellite_config.com

$!      IDENT X-23N6
$!
$!++
$! Facility:    SATELLITE_CONFIG, Local Area VAXcluster Satellite Configuration
$!                                Procedure
$!
$! Module:      SATELLITE_CONFIG
$!
$! Abstract:    This procedure enables a satellite node to enter or leave a
$!              Local Area cluster. It has three commands: ADD, REMOVE,
$!              MODIFY.
$!
$!              The ADD command establishes a root directory on the boot node,
$!              updates the network database for remote booting, creates 
$!              specific parameter files for the satellite node, and creates
$!              the satellite paging and swapping files.
$!
$!              The REMOVE command deletes the root directory on the boot node
$!              and updates the network database to disable remote booting.
$!
$!              The MODIFY command modifies the information in the boot node's
$!              network database, pertaining to the satellite node.
$!
$! Author:      Linda G. Duffell
$!
$! Created:     03-Jul-1986  
$!
$! Modifications:
$!
$!      X-23N6  CJB026          Cheryl J. Bulmer        13-May-1987
$!              Remove search for RIGHTSLIST.DAT and remove check for
$!              boot node.
$!
$!      X-23N5  CJB020          Cheryl J. Bulmer        4-Mar-1987
$!              Change logicals for network databases.
$!
$!      X-23N4  CJB019          Cheryl J. Bulmer        27-Feb-1987
$!              Added support for roots on a second system disk.
$!              Remove prompts from MODIFY for root and system disk
$!              as they were not being used for anything.
$!
$!      X-23N3  CJB018          Cheryl J. Bulmer        27-Jan-1987
$!
$!              Remove SYSGEN parameters from MODPARAMS.DAT because
$!              they are now being calculated by AUTOGEN.
$!
$!                      PE5=0
$!                      MVTIMEOUT=3600
$!                      PASTDGBUF=10
$!                      RECNXINTERVAL=20
$!                      SPTREQ=2300
$!                      VMSD4=0
$!
$!
$!      X-23N2  LGD025          Linda G. Duffell        25-Nov-1986
$!              Must translate logical device name now that we are
$!              accepting alternate device.
$!
$!      X-23N1  LGD024          Linda G. Duffell        20-Nov-1986
$!              Take out check for remote disk being on the same node.
$!
$!      X-23    LGD023          Linda G. Duffell        11-Nov-1986
$!              Put back question for DISK name.
$!
$!      X-22    LGD022          Linda G. Duffell        11-Nov-1986
$!              Add more comments.
$!
$!      X-21    LGD021          Linda G. Duffell        05-Nov-1986
$!              Corrected fix for VAXstar.
$!
$!      X-20    LGD020          Linda G. Duffell        31-Oct-1986
$!              VAXstar disks look like a floppy from the remote
$!              so put in a special for these disks to allow user
$!              to put local paging/swapping on them.
$!
$!      X-19    LGD019          Linda G. Duffell        22-Oct-1986
$!              Corrected MODIFY so that it does not always try to
$!              update MODPARAMS and VAXVMSSYS.
$!
$!      X-18    LGD018          Linda G. Duffell        20-Oct-1986
$!              Corrected save_ncp so that it would always find
$!              Netnode_update if there was a search path associated
$!              with it.
$!
$!      X-17    LGD017          Linda G. Duffell        17-Oct-1986
$!              No longer support a second disk. Clean-up alot for
$!              released version.
$!
$!      X-16    LGD016          Linda G. Duffell        29-Sep-1986
$!              Get rid of colon when user specifies the local disk to
$!              use for paging and swapping. Clean up the network database
$!              if error detected in setting up the network database.
$!
$!      X-15    LGD015          Linda G. Duffell        17-Sep-1986
$!              Corrected a GOTO label. (init_dsk)
$!
$!      X-13,14 LGD014          Linda G. Duffell        05-Sep-1986
$!              LGD013
$!              Purge NETNODE_UPDATE.COM after removing a node.
$!
$!      X-12    LGD012          Linda G. Duffell        04-Sep-1986
$!              Changed prompt for "DISK" to "device name".
$!
$!      X-11    LGD011          Linda G. Duffell        03-Sep-1986
$!              When creating the sys$common area make sure it points
$!              to the specified disk and SYS0 root as opposed to
$!              SYS$SPECIFIC.
$!
$!      X-10    LGD010          Linda G. Duffell        02-Sep-1986
$!              Commented out the IVP.
$!
$!      X-9     LGD009          Linda G. Duffell        28-Aug-1986
$!              Got rid of install commands in Satellite_page.com.
$!              By the time Startup.com calls us, mountshr...should
$!              already be installed.
$!
$!      X-8     LGD008          Linda G. Duffell        27-Aug-1986
$!              Added support for the IVP and more cleanup for FT2.
$!
$!      X-7     LGD007          Linda G. Duffell        11-Aug-1986
$!              No longer calculate the value for PE6, change to 
$!              angle brackets for file specs., add support for 
$!              building a .COM file to keep track of updates to
$!              network data base. Add a number of enhancements for
$!              field test 2.
$!--
$! 
$ !
$ ! Define some symbols that will be used frequently.
$ !
$       say = "WRITE SYS$OUTPUT"
$       ask = "INQUIRE /NOPUNCT"
$       f_log = "/LOG"
$       ncp = "$ncp"
$       sd = "SYS$SYSDEVICE:"
$       sysgen = "$sysgen"
$       tmp_pfsize = 4096 + 512
$       min_pfsize = 10000
$       default_pfsize = min_pfsize
$       min_swpsize = 8000
$       default_swapsize = min_swpsize
$       dflt_dir = "<SYSEXE>"
$       dflt_locdir = "<SYS0.SYSEXE>"
$       dflt_page = "PAGEFILE.SYS"
$       temp_page = "PAGEFILE.TMP"
$       dflt_swap = "SWAPFILE.SYS"
$       error_flag = 1
$       run_ivp = "NO"
$       sat_page = 1
$
$       say "           Satellite Configuration Procedure"
$       say ""
$Prmptuser:
$       type SYS$INPUT

    This procedure configures a satellite node in the cluster.
    It can ADD or REMOVE a satellite node, and it can MODIFY 
    the network database.

    To ensure that you have the required privileges, invoke this
    procedure from the system manager's account.

    If the local disk on the satellite node is to be INITIALIZED for 
    paging and swapping, please be sure you are satisfied with the
    BACKUP of the local disk before proceeding.

$       ask P1 "ADD, REMOVE or MODIFY a satellite node [ADD]? "
$       if P1 .eqs. "" then goto addnode
$       IF F$LOCATE(P1,"ADD") .EQ. 0 THEN GOTO addnode
$       IF F$LOCATE(P1,"REMOVE") .EQ. 0 THEN GOTO remnode
$       IF F$LOCATE(P1,"MODIFY") .EQ. 0 THEN GOTO modnode
$       say "Invalid response."
$       P1 = ""
$       GOTO prmptuser
$ !
$ ! Add a node to the cluster.
$ !
$Addnode:
$ !
$ ! This section was originally based on MAKEROOT.
$ !
$MAKEROOT:
$ !
$ ! Verify that this system is set up to be a cluster.
$ !
$       if f$trnlnm("SYS$SPECIFIC") .eqs. f$trnlnm("SYS$COMMON") then goto notcdisk
$       if f$getsyi("VAXCLUSTER") .eq. 0 then goto notcluster
$
$ !
$ ! Find the datalink circuits which exist on the boot node.
$ !
$       say "Verifying circuits in network database..."
$       found_datalink = 0
$       datalink_string = ""
$ !
$ ! If we have both a BNT and a UNA device on the boot node, then
$ ! STACONFIG will always think the connection is on the BNT. So
$ ! in this case we would always set up the BNT. First just do a
$ ! show lines in order to determine if a BNT exists.
$ !
$
$       bnt_exists = 0
$
$       IF F$SEARCH("sys$scratch:gen_node.tmp") .EQS. "" THEN GOTO notmp
$       delete/nolog sys$scratch:gen_node.tmp;*
$Notmp:
$       ncp show known lines to sys$scratch:gen_node.tmp
$       open/read gennode$showlines sys$scratch:gen_node.tmp -
        /error=no_devices
$Chk_bnt:
$       read gennode$showlines record -
        /end_of_file=no_bnt
$ !
$ ! Get rid of leading spaces
$ !
$       record = F$EDIT(record,"TRIM,COMPRESS,UPCASE")
$       IF F$LOCATE("BNT-",record) .NE. F$LENGTH(record) THEN GOTO fnd_bnt
$       GOTO chk_bnt
$Fnd_bnt:
$       bnt_exists = 1 
$No_bnt:
$       close gennode$showlines
$       delete /nolog sys$scratch:gen_node.tmp;*
$
$       offon = 0
$       ncp show known circ char to sys$scratch:gen_node.tmp
$       open/read gennode$showlines sys$scratch:gen_node.tmp -
        /error=no_devices
$Read_next_device:
$       read gennode$showlines line -
        /end_of_file=no_devices
$ !
$ ! Get rid of leading spaces
$ !
$       line = F$EDIT(line,"TRIM,COMPRESS,UPCASE")
$       IF bnt_exists .EQ. 1 THEN GOTO loc_bnt
$       IF F$LOCATE("UNA-",line) .NE. F$LENGTH(line) THEN GOTO point_to_point
$       IF F$LOCATE("QNA-",line) .NE. F$LENGTH(line) THEN GOTO point_to_point
$       IF F$LOCATE("SVA-",line) .NE. F$LENGTH(line) THEN GOTO point_to_point
$       GOTO read_next_device
$Loc_bnt:
$       IF F$LOCATE("BNT-",line) .NE. F$LENGTH(line) THEN GOTO point_to_point
$       GOTO read_next_device
$Point_to_point:
$       datalink = F$EDIT(F$EXTRACT(F$LOCATE("=",line)+2,999,line),"TRIM")
$       found_datalink = found_datalink + 1
$Fnd_state:
$       read gennode$showlines line -
        /end_of_file=offstate
$       line = F$EDIT(line,"TRIM,COMPRESS,UPCASE")
$       IF F$LOCATE("STATE",line) .NE. F$LENGTH(line) THEN GOTO fnd_state1
$       GOTO fnd_state
$Fnd_state1:
$       IF F$LOCATE("OFF",line) .NE. F$LENGTH(line) THEN GOTO offstate
$ !
$ ! Here if state is ON. We need to check if SERVICE is enabled.
$ !
$Fnd_serv: 
$       read gennode$showlines line -
        /end_of_file=prmpt_set_serv
$       line = F$EDIT(line,"TRIM,COMPRESS,UPCASE")
$       IF F$LOCATE("SERVICE",line) .NE. F$LENGTH(line) THEN GOTO fnd_serv1
$       GOTO fnd_serv
$Fnd_serv1:
$       IF F$LOCATE("ENABLED",line) .NE. F$LENGTH(line) THEN GOTO no_devices
$Prmpt_set_serv:
$       ask a "May this procedure temporarily interrupt DECnet traffic [YES]? "
$       IF a .EQS. "" THEN GOTO offstate
$       IF F$LOCATE(a,"NO") .EQ. 0 THEN GOTO leave
$       IF F$LOCATE(a,"YES") .EQ. 0 THEN GOTO offstate
$       say "Invalid response."
$       GOTO prmpt_set_serv
$
$Leave:
$       close gennode$showlines
$       delete/nolog sys$scratch:gen_node.tmp;*
$       say "Please stop circuit before running this procedure."
$       EXIT
$
$Offstate:
$       offon = 1
$
$No_devices:
$       close gennode$showlines
$       delete/nolog sys$scratch:gen_node.tmp;*
$       IF found_datalink .NE. 0 THEN GOTO makeroot1
$       say "This system does not have an Ethernet device."
$       EXIT
$
$Makeroot1:
$ !
$ ! Prompt for the disk name.
$ ! 
$       ask disk "What is the device name for the new system root [''sd']? "
$       IF disk .EQS. "" THEN disk = sd
$       disk = F$GETDVI("''disk'","FULLDEVNAM")-"_"
$ !
$ ! Translate the logical name.
$ !
$       trans_sd = disk
$Translate:
$       trans_sd = trans_sd - ":"
$       IF F$TRNLNM("''trans_sd'") .EQS. "" THEN GOTO no_translate
$       trans_sd = F$TRNLNM("''trans_sd'") 
$       GOTO translate
$No_translate:
$       trans_sd = trans_sd + ":"
$       disk = disk - ":"
$       disk = disk + ":"
$       IF .NOT. F$GETDVI("''disk'", "EXISTS") THEN GOTO baddisk
$       IF .NOT. F$GETDVI("''disk'", "AVL") THEN GOTO baddisk
$       IF .NOT. F$GETDVI("''disk'", "MNT") THEN GOTO baddisk
$       sd = disk
$ 
$ !
$ ! Get the default system root name.
$ !
$       x = 0
$Numb:
$       x = x + 1
$       IF x .gt. 9 THEN GOTO checkalpha
$       IF F$SEARCH("''sd'<000000>SYS''x'.dir") .eqs. "" then GOTO fndroot
$       GOTO numb
$Checkalpha:
$       x = "A"
$       IF F$SEARCH("''sd'<000000>SYS''x'.dir") .eqs. "" then GOTO fndroot
$       x = "B"
$       IF F$SEARCH("''sd'<000000>SYS''x'.dir") .eqs. "" then GOTO fndroot
$       x = "C"
$       IF F$SEARCH("''sd'<000000>SYS''x'.dir") .eqs. "" then GOTO fndroot
$       x = "D"
$       IF F$SEARCH("''sd'<000000>SYS''x'.dir") .eqs. "" then GOTO fndroot
$       say "There are no more free roots on ''sd'."
$       EXIT 1
$ !
$ ! Here if the DISK is invalid.
$ !
$Baddisk:
$       say "Invalid diskname or disk not mounted."
$       GOTO makeroot1
$
$Fndroot:
$       dfltroot= "SYS" + "''x'"
$ !
$ !
$ ! Get a valid system root name.
$ !
$       root = ""
$GET_ROOT:
$       if root .nes. "" then goto chk_root
$       ask root "What is the name of the new system root [''dfltroot']? "
$       IF root .EQS. "" THEN root = dfltroot
$Chk_root:
$       remove_flg = 0
$       GOSUB check_root
$       IF root .EQS. "" THEN GOTO get_root
$ !
$ ! Get a valid node name and system id.
$ !
$       GOSUB get_node_sub
$       GOSUB verify_node
$       scssystemid = ""
$GET_ID:
$       if scssystemid .nes. "" then goto chk_id
$       ask scssystemid "What is the DECnet node address of the satellite node? "
$       goto get_id
$CHK_ID:
$       GOSUB check_id
$       IF scssystemid .EQS. "" THEN GOTO get_id
$ !
$ ! For convenience, prompt now for conversational booting.
$ !
$Ask_for_inter:
$       ask boot_flg "Allow conversational bootstraps on the satellite node [NO]? "
$       IF boot_flg .EQS. "" THEN GOTO no_inter
$       IF F$LOCATE(boot_flg,"NO") .EQ. 0 THEN GOTO no_inter
$       IF F$LOCATE(boot_flg,"YES") .EQ. 0 THEN GOTO inter
$       say "Invalid response."
$       GOTO ask_for_inter
$Inter:
$       boot_flg = 1
$       GOTO doit
$No_inter:
$       boot_flg = 0
$ !
$ ! Create new directory tree.
$ !
$DOIT:
$!
$!      Get the system cluster logicals
$!      
$       lnm = "SYSUAF"
$       GOSUB FIND_LOGICALS
$       SYSUAF_DISK = LOG_DISK
$       SYSUAF_FILE = FULL_FILE_SPEC
$!
$! Create directory tree
$!
$       say "Creating directory tree ''ROOT'..."
$       cd = "CREATE /DIR 'F_LOG' /OWN=<1,4> /PROT=(S=RWE,O=RWE,G=RE,W=RE) 'SD'<''ROOT'"
$       trans_sdroot = trans_sd + "<" + root + ">"
$       sdroot = sd + "<" + root + ">"
$       common = sd + "<000000>v4common.dir"
$       if f$search("''sd'<0,0>''root'.dir") .eqs. "" then 'cd'>
$
$       ON ERROR THEN GOTO add_err
$       ON CONTROL_Y THEN GOTO add_err
$
$       if f$search("''sdroot'sysexe.dir") .eqs. "" then 'cd'.sysexe>
$       if f$search("''sdroot'syslib.dir") .eqs. "" then 'cd'.syslib>
$       set file /enter='sdroot'syscommon.dir -
        'common'; 'f_log'
$       if f$search("''sdroot'systest.dir") .eqs. "" then 'cd'.systest>
$       if f$search("''sdroot'sysmaint.dir") .eqs. "" then 'cd'.sysmaint>
$       if f$search("''sdroot'sysmgr.dir") .eqs. "" then 'cd'.sysmgr>
$       if f$search("''sdroot'syshlp.dir") .eqs. "" then 'cd'.syshlp>
$       if f$search("''sd'<''root'syshlp>examples.dir") .eqs. "" then 'cd'.syshlp.examples>
$       if f$search("''sdroot'sysupd.dir") .eqs. "" then 'cd'.sysupd>
$       if f$search("''sdroot'sysmsg.dir") .eqs. "" then 'cd'.sysmsg>
$       if f$search("''sdroot'syserr.dir") .eqs. "" then 'cd'.syserr>
$       if f$search("''sdroot'syscbi.dir") .eqs. "" then 'cd'.syscbi>
$       say "System root ''ROOT' created."
$ !
$ !
$ ! Create MODPARAMS.DAT and VAXVMSSYS.PAR.
$ !
$       sdroot = sdroot - ">"
$       trans_sdroot = trans_sdroot - ">"
$ !
$ ! Create MODPARAMS.DAT.
$ !
$       open /write f1 'sdroot'.sysexe>modparams.dat
$       write f1 "!"
$       write f1 "! Site specific AUTOGEN data file.  In a VAXcluster where a common system"
$       write f1 "! disk is being used, this file should reside in SYS$SPECIFIC:<SYSEXE>,"
$       write f1 "! not a common system directory."
$       write f1 "!"
$       write f1 "! Add modifications that you wish to make to AUTOGEN's hardware configuration"
$       write f1 "! data, system parameter calculations, and page, swap, and dump file sizes to "
$       write f1 "! the bottom of this file.  "
$       write f1 "!"
$       write f1 "SCSNODE=""''SCSNODE'"""
$       write f1 "SCSSYSTEMID=''expanded_id'"
$       write f1 "PE3=''boot_flg'"
$       write f1 "PE6=1"
$       write f1 "VAXCLUSTER=2"
$       write f1 "PAGEFILE=0"
$       write f1 "SWAPFILE=0"
$       close f1
$
$       copy sys$common:<sysmgr>vmsimages.dat 'sd'<'root'.sysmgr>
$
$ ! 
$ ! Create VAXVMSSYS.PAR
$ !
$       open /write f1 sys$scratch:gen_node.tmp
$       write f1 "$ RUN SYS$SYSTEM:SYSGEN"
$!
$! If the seed file VAXVMSSYS.EVC does not exist, use the default
$! settings, which while bad, are not as bad as using CURRENT which
$! would be the boot node's setting. (Things like ALLOCLASS would not
$! be set correctly and mounted disks appear unmounted.) The true fix
$! needs to be done by AUTOGEN.
$!
$       write f1 "USE DEFAULT"
$       write f1 "USE SYS$MANAGER:VAXVMSSYS.EVC"
$       write f1 "SET SCSNODE ""''SCSNODE'"""
$       write f1 "SET SCSSYSTEMID ''expanded_id'"
$       write f1 "WRITE ''SDROOT'.SYSEXE>VAXVMSSYS.PAR"
$       write f1 "EXIT"
$       write f1 "$ EXIT 1"
$       close f1
$       @sys$scratch:gen_node.tmp
$       delete/nolog sys$scratch:gen_node.tmp;*
$ !
$       GOTO hdwrprmpt
$
$NOTCDISK:
$       say "This system disk is not set up as a cluster system disk."
$       exit
$NOTCLUSTER:
$       say "This node is not booted with VAXcluster NE 0"
$       exit
$ !
$ ! END OF MAKEROOT
$ !
$ !
$ !
$ ! Update the network database
$ !
$Hdwrprmpt:
$ !
$ ! Get and verify hardware address.
$ !
$       ask num "What is the hardware address of the satellite node? "
$       GOSUB CHECK_HDWADDR
$       IF num .EQS. "" THEN GOTO hdwrprmpt
$ !
$ ! Set up the DECnet database for this node.
$ !
$Validnum:
$       say "Updating network database..."
$       IF F$SEARCH("sys$scratch:satellite_ncp.tmp") .NES. "" THEN -
         delete/nolog sys$scratch:satellite_ncp.tmp;*
$       open/write gennode$file  sys$scratch:gen_node.tmp
$       write gennode$file "$ define/user sys$output nl:"
$       write gennode$file "$ define/user sys$error sys$scratch:satellite_ncp.tmp"
$       write gennode$file "$ run sys$system:ncp"
$       write gennode$file "    define node ",scsnode," address ",scssystemid
$       write gennode$file "    define node ",scsnode," hardware address ",num
$       write gennode$file "    define node ",scsnode," load assist agent sys$share:niscs_laa.exe"
$       write gennode$file "    define node ",scsnode," load assist parameter ",sdroot,".>"
$       write gennode$file "    define node ",scsnode," service circuit ",datalink
$       write gennode$file "    define line    ",datalink," state on"
$       write gennode$file "    define circuit ",datalink," state off"
$       write gennode$file "    define circuit ",datalink," service enabled state on"
$       write gennode$file "    set node ",scsnode," all"
$       write gennode$file "    set line    ",datalink," state on"
$       IF offon .EQ. 0 THEN GOTO skpcirc
$       write gennode$file "    set circuit ",datalink," state off"
$       write gennode$file "    set circuit ",datalink," service enabled state on"
$Skpcirc:
$       close gennode$file
$       @sys$scratch:gen_node.tmp
$       delete/nolog sys$scratch:gen_node.tmp;*
$       GOSUB chk_ncp_errs
$       IF error_flag .NE. 0 THEN GOTO no_errs
$       IF F$SEARCH("sys$scratch:satellite_ncp.tmp") .NES. "" THEN -
         delete/nolog sys$scratch:satellite_ncp.tmp;*
$       open/write gennode$file  sys$scratch:gen_node.tmp
$       write gennode$file "$ define/user sys$output nl:"
$       write gennode$file "$ define/user sys$error nl:"
$       write gennode$file  "$ run sys$system:ncp"
$       write gennode$file  "    purge node ",scsnode," hardware address"
$       write gennode$file  "    purge node ",scsnode," load assist agent"
$       write gennode$file  "    purge node ",scsnode," load assist parameter"
$       write gennode$file  "    clear node ",scsnode," hardware address"
$       write gennode$file  "    clear node ",scsnode," load assist agent"
$       write gennode$file  "    clear node ",scsnode," load assist parameter"
$       close gennode$file 
$       @sys$scratch:gen_node.tmp
$       delete/nolog sys$scratch:gen_node.tmp;*
$       GOTO add_err
$
$No_errs:
$       ON ERROR THEN EXIT
$       ON CONTROL_Y THEN EXIT
$
$       GOSUB save_ncp
$       GOTO create_page
$
$ !
$Add_err:
$ !
$ ! Here if an error occurs before the network database has been updated.
$ ! This will delete the root directory and exit.
$ !
$       GOSUB del_root
$       say ""
$       say "The satellite node has been REMOVED."
$       EXIT
$ !
$ !
$Create_page:
$ !
$ ! Prompt the user for the size of the page/swap file. If the user wants
$ ! local paging then create a temporary page file so that the satellite
$ ! can initially boot. Otherwise, create the requested page and swap file
$ ! on the boot node.
$ !     
$
$Get_pfsize:
$       ask pfsize "Size of pagefile for the new satellite [''default_pfsize' blocks]? "
$       IF pfsize .EQS. "" THEN pfsize = default_pfsize
$       t1 = F$INTEGER(pfsize)
$       IF t1 .GE. min_pfsize THEN GOTO get_swapsize
$       say "Pagefile must be at least ''min_pfsize'."
$       GOTO get_pfsize
$
$Get_swapsize:
$       ask swapsize "Size of swap file for the new satellite [''default_swapsize' blocks]? "
$       IF swapsize .EQS. "" THEN swapsize = default_swapsize
$       t1 = F$INTEGER(swapsize)
$       IF t1 .GE. min_swpsize THEN GOTO local_disk
$       say "Swapfile must be at least ''min_swpsize'."
$       GOTO get_swapsize
$Local_disk: 
$       ask local "May the local satellite disk be used for paging and swapping? "
$       IF local .EQS. "" THEN GOTO local_disk
$       IF F$LOCATE(local,"NO") .EQ. 0 THEN GOTO nolocal
$       IF F$LOCATE(local,"YES") .EQ. 0 THEN GOTO local_pgswp
$       say "Invalid response."
$       GOTO local_disk
$Local_pgswp:
$ !
$ ! Create the initial page and startup file.
$ !  
$       say "Creating temporary page file in order to boot ''scsnode' the first time..."
$       IF F$SEARCH("''SDROOT'.SYSEXE>''dflt_page'") .EQS. "" THEN GOTO nopag
$       IF F$FILE("''SDROOT'.SYSEXE>''dflt_page'","ALQ") .GE. tmp_pfsize THEN GOTO create_inistart
$Nopag:
$       SYSGEN CREATE 'SDROOT'.SYSEXE>'dflt_page'/SIZE='tmp_pfsize'
$       SET FILE 'SDROOT'.SYSEXE>'dflt_page'/NOBACKUP
$Create_inistart:
$
$       !GOSUB prmpt_IVP
$
$ !
$ ! Write STARTUP1.COM. This file is the initial startup file for the satellite
$ ! node. When the satellite node comes up, the local disks will be served.
$ ! Satellite_config will be running on the boot node and see the served disks.
$ ! It will ask the user which disk it can use for paging and swapping and then
$ ! create the requested files. It will then create INSTALL_PAGE.COM which will
$ ! install the local page/swap files. 
$ !
$ ! STARTUP1.COM waits 'til INSTALL_PAGE.COM has been created before proceeding.
$ ! It then proceeds to configure the network database, invoke autogen and 
$ ! reboot the satellite.
$ !
$       open /write f1 'sdroot'.sysexe>startup1.com
$       write f1 "$ verify = 'F$VERIFY(0)'"
$       write f1 "$ !"
$       write f1 "$ say = ""WRITE SYS$OUTPUT"""
$       write f1 "$Start_loop:"
$       write f1 "$ IF F$SEARCH(""''trans_sdroot'.sysexe>install_page.com"") .NES. """" THEN -"
$       write f1 "$     GOTO start_cont"
$       write f1 "$ say ""Waiting to tune system..."""
$       write f1 "$ wait 00:00:10"
$       write f1 "$ GOTO start_loop"
$       write f1 "$Start_cont:"
$       write f1 "$ wait 00:00:15"
$       write f1 "$ @''trans_sdroot'.sysexe>install_page.com
$       write f1 "$ delete ''trans_sdroot'.sysexe>install_page.com;*
$ !
$       write f1 "$root = f$getdvi(""SYS$SYSDEVICE"",""fulldevnam"") - ""_"""
$       write f1 "$if f$trnlnm(""SYS$TOPSYS"",""LNM$SYSTEM"") .nes. """" then -"
$       write f1 "root = root + ""<"" + f$trnlnm(""SYS$TOPSYS"",""LNM$SYSTEM"") + "".>"""
$       write f1 "$define/system/exec/nolog/translation=(terminal,concealed) sys$specific 'root"
$       write f1 "      no_common_root = f$search(""SYS$SPECIFIC:<000000>SYSCOMMON.DIR"") .eqs. """"
$       write f1 "$if no_common_root then -"
$       write f1 "define/system/exec/nolog/translation=(terminal,concealed) sys$sysroot 'root"
$       write f1 "$if no_common_root then -"
$       write f1 "define/system/exec/nolog/translation=(terminal,concealed) sys$common 'root""
$       write f1 "$define/system/exec/nolog sys$sysdisk sys$sysroot:"
$       write f1 "$define/system/exec/nolog sys$errorlog sys$sysroot:<syserr>"
$       write f1 "$define/system/exec/nolog sys$examples sys$sysroot:<syshlp.examples>"
$       write f1 "$define/system/exec/nolog sys$help sys$sysroot:<syshlp>"
$       write f1 "$define/system/exec/nolog sys$instruction sys$sysroot:<syscbi>"
$       write f1 "$define/system/exec/nolog sys$library sys$sysroot:<syslib>"
$       write f1 "$define/system/exec/nolog sys$maintenance sys$sysroot:<sysmaint>"
$       write f1 "$define/system/exec/nolog sys$manager sys$sysroot:<sysmgr>"
$       write f1 "$define/system/exec/nolog sys$update sys$sysroot:<sysupd>"
$       write f1 "$define/system/exec/nolog sys$test sys$sysroot:<systest>"
$       write f1 "$define/table=lnm$system_directory/super lnm$dcl_logical lnm$file_dev"
$ !
$       write f1 "$ RUN SYS$SYSTEM:SYSGEN"
$       write f1 "AUTOCONFIGURE ALL"
$       write f1 "EXIT"
$ !
$ !
$ ! Define cluster logicals
$ !
$       write f1 "$ DEFINE NETCIRC SYS$SPECIFIC:<SYSEXE>NETCIRC.DAT"
$       write f1 "$ DEFINE NETLINE SYS$SPECIFIC:<SYSEXE>NETLINE.DAT"
$       write f1 "$ DEFINE NETOBJECT SYS$SPECIFIC:<SYSEXE>NETOBJECT.DAT"
$       write f1 "$ DEFINE NETLOGING SYS$SPECIFIC:<SYSEXE>NETLOGING.DAT"
$       write f1 "$ DEFINE NETNODE_LOCAL SYS$SPECIFIC:<SYSEXE>NETNODE_LOCAL.DAT"
$       write f1 "$ DEFINE NETNODE_REMOTE SYS$SPECIFIC:<SYSEXE>NETNODE_REMOTE.DAT"
$       write f1 "$ DEFINE NETCONF SYS$SPECIFIC:<SYSEXE>NETCONF.DAT"
$       write f1 "$ IF F$SEARCH(""sys$common:<sysexe>netnode_remote.dat"") .EQS. """" THEN GOTO install"
$       write f1 "$ DEFINE NETNODE SYS$SPECIFIC:<SYSEXE>NETNODE.DAT"
$       write f1 "$INSTALL:"
$       write f1 "$ install = ""$install"""
$       write f1 "$ install sys$common:<syslib>secureshr /open/header/shared/protect"
$       write f1 "$ install sys$common:<syslib>dismntshr /open/header/shared/protect/nopurge"
$       write f1 "$ install sys$common:<syslib>mountshr /open/header/shared/protect"
$       write f1 "$ install sys$common:<sysmsg>sysmgtmsg"
$!
$! For two boot disk configurations, define cluster common file
$! SYSUAF in the satellite's startup com file. Must 
$! do after mountshr installation.
$!
$       vol_label = F$GETDVI("''SYSUAF_DISK'","VOLNAM")
$       write f1 "$if .not. F$GETDVI(""''SYSUAF_DISK'"",""MNT"") then -"
$       write f1 " mount/system ''sysuaf_disk' ''vol_label'"
$       write f1 "$define/system/exec/nolog sysuaf ''sysuaf_file'"
$!
$!
$       write f1 "$ say ""Configuring network..."""
$       write f1 "$ @SYS$MANAGER:NETCONFIG ''scsnode' ''scssystemid' NO NO YES"
$       write f1 "$ ncp =""$ncp"""
$       write f1 "$ ncp define executor alias incoming disabled"
$       write f1 "$ ncp purge known logging known events"
$!
$! If the system manager has defined a logical for netnode_remote then delete the .dat file in
$! the specific root for consistency's sake
$!
$ if F$TRNLNM("NETNODE_REMOTE") .eqs. "" THEN GOTO Cont_startup1
$       write f1 "$ delete/nolog sys$specific:<sysexe>netnode_remote.dat;*"
$       write f1 "$ goto norem"
$ Cont_startup1:
$       write f1 "$ IF F$SEARCH(""sys$specific:<sysexe>netnode_remote.dat"") .EQS. """" THEN GOTO norem"
$       write f1 "$ IF F$SEARCH(""sys$common:<sysexe>netnode_remote.dat"") .EQS. """" THEN GOTO norem"
$       write f1 "$ delete/nolog sys$specific:<sysexe>netnode_remote.dat;*"
$       write f1 "$NOREM:"
$ !
$       IF run_ivp .EQS. "YES" THEN GOTO need_ivp
$       write f1 "$ @SYS$COMMON:<sysupd>AUTOGEN GETDATA REBOOT INITIAL"
$       GOTO close_file
$ !
$ ! If we're running the IVP then we must not let AUTOGEN do the REBOOT
$ ! since AUTOGEN will automatically reset the startup file to SYS$SYSTEM:
$ ! STARTUP.COM. (bug in AUTOGEN).
$ !
$Need_ivp:
$       write f1 "$ @SYS$COMMON:<sysupd>AUTOGEN GETDATA SETPARAMS INITIAL"
$       write f1 "$ !"
$       write f1 "$RUN SYS$SYSTEM:SYSGEN"
$       write f1 "USE CURRENT"
$       write f1 "SET/START SYS$SYSTEM:IVP_STARTUP.COM"
$       write f1 "WRITE CURRENT"
$       write f1 "EXIT"
$       write f1 "$ !"
$       write f1 "$ @sys$system:shutdown ""0"" ""Reboot system with AUTOGENerated parameters"" ""N"" -"
$       write f1 """Y"" ""soon"" ""Y"" ""REBOOT_CHECK"""
$
$Close_file:
$       write f1 "$ verify = 'F$VERIFY(verify)'"
$       close f1
$ !
$       open /write f1 sys$scratch:gen_node.tmp
$       write f1 "$ RUN SYS$SYSTEM:SYSGEN"
$       write f1 "USE ''SDROOT'.SYSEXE>VAXVMSSYS.PAR"
$       write f1 "SET /START SYS$SYSTEM:STARTUP1.COM"
$       write f1 "WRITE ''SDROOT'.SYSEXE>VAXVMSSYS.PAR"
$       write f1 "EXIT"
$       write f1 "$ EXIT 1"
$       close f1
$       @sys$scratch:gen_node.tmp
$       delete/nolog sys$scratch:gen_node.tmp;*
$ !
$ !
$ ! Instruct the user to boot the satellite node.
$ !
$       IF .NOT. F$GETSYI("CLUSTER_MEMBER",scsnode) THEN GOTO clstr_boot
$       say "''scsnode' is already a member of the cluster."
$       say "Please reboot ''scsnode' now."
$Clstr_mem:
$       say "Waiting for satellite node to leave the cluster..."
$       wait 00:00:10
$       IF .NOT. F$GETSYI("CLUSTER_MEMBER",scsnode) THEN GOTO clstr_boot1
$       GOTO clstr_mem
$
$Clstr_boot:
$       type SYS$INPUT


    This procedure will now wait until the satellite node is a 
    member of this cluster.

    Once the satellite node joins the cluster, this procedure
    will ask you which local disk it can use for paging and
    swapping.
        
    Please boot the satellite node now.

$ !
$ ! Wait until the satellite becomes a cluster member. Once it is part
$ ! of the cluster, wait a reasonable amount of time to see the disks.
$ !
$Clstr_boot1:
$       say ""
$       timer = 0
$Chk_node:
$       say "Waiting for satellite node to boot..."
$       wait 00:00:10
$       IF F$GETSYI("CLUSTER_MEMBER",scsnode) THEN GOTO get_disk
$       GOTO chk_node
$Get_disk_repeat:
$       close gennode$showdev
$Get_disk:
$       timer = timer + 1
$       IF timer .GT. 2 THEN GOTO no_disks
$       wait 00:00:20
$       found_disk = 0
$       nodedollar = scsnode + "$"
$       disknam = nodedollar + "d"
$       define/user sys$output sys$scratch:gen_node.tmp
$       define/process sys$error nl:
$       show device/brief 'disknam
$       deassign/process sys$error
$       open/read gennode$showdev sys$scratch:gen_node.tmp -
        /error=get_disk_repeat
$       read gennode$showdev line -
        /end_of_file=get_disk_repeat
$       close gennode$showdev
$Prmpt_dsk:
$       say ""
$       say "The local disks on ",scsnode," are:"
$       type sys$scratch:gen_node.tmp
$       say ""
$       ask dsknam "Which disk can be used for paging and swapping? ''nodedollar'"
$       IF dsknam .EQS. "" THEN GOTO prmpt_dsk
$       dsknam = dsknam - ":"
$       dsk = dsknam
$       dsknam = "''nodedollar'" + ''dsknam'"
$       IF F$PARSE("''dsknam'",,,"DEVICE","SYNTAX_ONLY") .EQS. "" THEN GOTO inval_dsk
$       IF .NOT. F$GETDVI("''dsknam'", "EXISTS") THEN GOTO inval_dsk
$       temp = F$GETDVI("''dsknam'", "DEVTYPE")
$ !
$ ! Special check for VAXstar disk. The device type is seen as an RX02 (11)
$ ! and the device name is always "DUxx". Therefore, make sure we do not 
$ ! see this as a floppy.
$ !
$       IF (F$EXTRACT(0,2,F$EDIT(dsk,"UPCASE")) .EQS. "DU") .AND. -
        (temp .EQ. 11) THEN GOTO prmpt_init
$       IF (F$GETDVI("''dsknam'", "DEVCLASS") .NE. 1) .OR. -    ! DISK
             (temp .EQ. 11) .OR. -                              ! RX02
             (temp .EQ. 12) .OR. -                              ! RX04
             (temp .EQ. 16) .OR. -                              ! RX01
             (temp .EQ. 36) .OR. -                              ! RX33
             (temp .EQ. 26) THEN GOTO inval_typ                 ! RX50
$       GOTO prmpt_init
$Inval_dsk:
$       say "Invalid disk."
$       GOTO prmpt_dsk
$Inval_typ:
$       say "This procedure will not use a floppy disk for paging and swapping."
$       GOTO prmpt_dsk
$
$Prmpt_init:
$       ask inidsk "May this procedure INITIALIZE ''dsknam' [YES]? "
$       IF inidsk .EQS. "" THEN GOTO init_dsk
$       IF F$LOCATE(inidsk,"YES") .EQ. 0 THEN GOTO init_dsk
$       IF F$LOCATE(inidsk,"NO") .EQ. 0 THEN GOTO noinit
$       GOTO prmpt_init
$
$Init_dsk:
$       say "This procedure will initialize the disk, ''dsknam'."
$       ask dskbak "Are you satisfied with the BACKUP of ''dsknam' [NO]? "
$       IF dskbak .EQS. "" THEN GOTO noinit
$       IF F$LOCATE(dskbak,"YES") .EQ. 0 THEN GOTO init_dsk1
$       IF F$LOCATE(dskbak,"NO") .EQ. 0 THEN GOTO noinit
$       GOTO init_dsk
$Init_dsk1:
$       delete/nolog sys$scratch:gen_node.tmp;*
$       dsknam = dsknam - ":"
$       say "Initializing ''dsknam'..."
$       lvolnam = "''scsnode'_''expanded_id'"
$       init 'dsknam' 'lvolnam' /maximum_files=2000/nohighwater/headers=64
$       mount /noassist/data_check=(read,write) 'dsknam' 'lvolnam'
$ !
$ ! Make sure we dismount the disk if we get an error at this point
$ !
$       ON ERROR THEN GOTO DISMOUNT_EXIT
$       ON CONTROL_Y THEN GOTO DISMOUNT_EXIT
$
$ !
$ ! Create the page and swap file using SYSGEN.
$ !
$       IF F$SEARCH("''dsknam':<0,0>sysexe.dir") .EQS. "" THEN create/directory/log 'dsknam':<sysexe>/own=<1,4>
$       page_file = dsknam + ":" + dflt_dir + dflt_page
$       swap_file = dsknam + ":" + dflt_dir + dflt_swap
$       sysgen create 'page_file'/size='pfsize'
$       set file 'page_file'/nobackup
$       sysgen create 'swap_file'/size='swapsize'
$       set file 'swap_file'/nobackup
$       dismount/nounload 'dsknam' 
$ 
$       ON ERROR THEN EXIT
$       ON CONTROL_Y THEN EXIT
$
$ !
$ ! Go create SATELLITE_PAGE.COM - the file which installs the page/swap file.
$ !
$       GOTO write_sat
$ 
$Noinit:
$       delete/nolog sys$scratch:gen_node.tmp;*
$ !
$ ! Get the file specification for the page/swap file and let SYSGEN 
$ ! create/extend it on the satellite's local disk.
$ ! 
$       pagswp = "page"
$       dflt_spec = dflt_page
$       size = pfsize
$       GOSUB get_spec
$       pagswp = "swap"
$       dflt_spec = dflt_swap
$       size = swapsize
$       GOSUB get_spec
$ 
$Write_sat:
$ !
$ ! Write SATELLITE_PAGE.COM - file which installs page and swap files on local node.
$ !
$       open /write f1 'sdroot'.sysexe>satellite_page.com
$       write f1 "$ verify = 'F$VERIFY(0)'"
$       write f1 "$ !"
$       write f1 "$ !   Delete the temporary page file that Satellite_config created"
$       write f1 "$ !"
$       write f1 "$ if f$search(""''temp_page'"") .eqs. """" then goto MNTDEV"
$       write f1 "$ Delete/nolog ''temp_page';*"
$       write f1 "$ !"
$       write f1 "$ !   Install the secondary page and swap files"
$       write f1 "$ !"
$       write f1 "$"
$       write f1 "$MNTDEV:"
$       write f1 "$ mount /noassist/system ''dsknam' ''lvolnam'"
$       write f1 "$ if .not. f$getdvi(""''dsknam'"", ""MNT"") then goto NO_PAGEFILE"
$       write f1 "$"
$       write f1 "$INSTALL_FILES:"
$       write f1 "$"
$       write f1 "$ SYSGEN := $SYSGEN"
$       write f1 "$"
$       write f1 "$WAITSWAP:"
$       write f1 "$ if f$getdvi(""''dsknam'"", ""EXISTS"") then goto SWAPFILE"
$       write f1 "$ write SYS$OUTPUT ""***** Waiting for SWAPFILE device: ''dsknam' *****"""
$       write f1 "$ wait ::30"
$       write f1 "$ goto WAITSWAP"
$       write f1 "$SWAPFILE:"
$       write f1 "$ if f$search(""''swap_file'"") .eqs. """" then goto WAITPAGE"
$       write f1 "$ SYSGEN INSTALL ''swap_file' /SWAPFILE"
$       write f1 "$"
$       write f1 "$WAITPAGE:"
$       write f1 "$ if f$getdvi(""''dsknam'"", ""EXISTS"") then goto PAGEFILE"
$       write f1 "$ write SYS$OUTPUT ""***** Waiting for PAGEFILE device: ''dsknam' *****"""
$       write f1 "$ wait ::30"
$       write f1 "$ goto WAITPAGE"
$       write f1 "$PAGEFILE:"
$       write f1 "$ if f$search(""''page_file'"") .eqs. """" then goto NO_PAGEFILE"
$       write f1 "$ SYSGEN INSTALL ''page_file' /PAGEFILE /NOCHECK"
$       write f1 "$"
$       write f1 "$ verify = 'F$VERIFY(verify)'"
$       write f1 "$ EXIT"
$       write f1 "$NO_PAGEFILE:"
$       write f1 "$ WRITE SYS$OUTPUT ""Did not install page or swap file"""
$       write f1 "$ verify = 'F$VERIFY(verify)'"
$       write f1 "$ EXIT"
$       write f1 "$"
$       close f1
$
$ !
$ ! Write INSTALL_PAGE.COM - This file is executed only once by STARTUP1.COM.
$ !  Once it is created, STARTUP1.COM knows enough to proceed and executes
$ !  the commands in INSTALL_PAGE.COM.
$ !
$       open /write f1 'sdroot'.sysexe>install_page.com
$       write f1 "$ verify = 'F$VERIFY(0)'"
$       write f1 "$ install = ""$install"""
$       write f1 "$ install sys$common:<syslib>mountshr /open/header/shared/protect"
$       write f1 "$ mount /noassist/system ''dsknam' ''lvolnam'"
$       write f1 "$"
$       write f1 "$RUN SYS$SYSTEM:SYSGEN"
$       write f1 "USE CURRENT"
$       write f1 "INSTALL ''page_file' /PAGEFILE"
$       write f1 "INSTALL ''swap_file' /SWAPFILE"
$       write f1 "SET/START SYS$SYSTEM:STARTUP.COM"
$       write f1 "WRITE CURRENT"
$       write f1 "EXIT"
$       write f1 "$ install sys$common:<syslib>mountshr /delete"
$       write f1 "$ verify = 'F$VERIFY(verify)'"
$       close f1
$ !
$ ! Wait for the Satellite node to REBOOT and then cleanup.
$ !
$Wait_loop:
$       IF (F$GETSYI("CLUSTER_MEMBER",scsnode) .EQ. 0 ) .AND. -
           (F$SEARCH("''sdroot'.sysexe>install_page.com") .EQS. "") THEN GOTO clean_up
$       say "Waiting for AUTOGEN to reboot satellite..."
$       wait 00:00:30
$       GOTO wait_loop
$ !
$ ! Cleanup section...get rid of STARTUP1.COM file in specific root
$ !
$Clean_up:
$       Delete/nolog 'sdroot.sysexe>startup1.com;*
$ !
$ ! We cannot take the chance of deleting the pagefile here since
$ ! the satellite may be dumping to this space. SATELLITE_PAGE.COM
$ ! will delete the file.
$       Rename/nolog 'sdroot.sysexe>'dflt_page;* 'sdroot.sysexe>'temp_page;*
$       GOTO the_end
$ !
$ ! SATELLITE NODE COMPLETION
$ !
$The_end:
$       say "The satellite configuration procedure has successfully completed."
$       EXIT 1
$No_disks:
$       delete/nolog sys$scratch:gen_node.tmp;*
$       say "There are no local disks on node ''scsnode'."
$       say "Creating page and swap files on the boot node."
$       IF F$SEARCH("''SDROOT'.SYSEXE>''dflt_page'") .EQS. "" THEN GOTO nopag1
$       IF F$FILE("''SDROOT'.SYSEXE>''dflt_page'","ALQ") .GE. pfsize THEN GOTO create_swap
$Nopag1:
$       SYSGEN CREATE 'SDROOT'.SYSEXE>'dflt_page'/SIZE='pfsize'
$       SET FILE 'SDROOT'.SYSEXE>'dflt_page'/NOBACKUP
$Create_swap:
$       IF F$SEARCH("''SDROOT'.SYSEXE>''dflt_swap'") .EQS. "" THEN GOTO noswap1
$       IF F$FILE("''SDROOT'.SYSEXE>''dflt_swap'","ALQ") .GE. swapsize THEN GOTO create_swap
$Noswap1:
$       SYSGEN CREATE 'SDROOT'.SYSEXE>'dflt_swap'/SIZE='swapsize'
$       SET FILE 'SDROOT'.SYSEXE>'dflt_swap'/NOBACKUP
$Create_install:
$ !
$ ! Write INSTALL_PAGE.COM - This file is executed only once by STARTUP1.COM.
$ !  Once it is created, STARTUP1.COM knows enough to proceed and executes
$ !  the commands in INSTALL_PAGE.COM.
$ !
$       open /write f1 'sdroot'.sysexe>install_page.com
$       write f1 "$ verify = 'F$VERIFY(0)'"
$       write f1 "$RUN SYS$SYSTEM:SYSGEN"
$       write f1 "USE CURRENT"
$       write f1 "SET/START SYS$SYSTEM:STARTUP.COM"
$       write f1 "WRITE CURRENT"
$       write f1 "EXIT"
$       write f1 "$ verify = 'F$VERIFY(verify)'"
$       close f1
$       say "The satellite configuration procedure has successfully completed."
$       EXIT 1
$ !
$ ! EXIT handler if the device is mounted and an error or ^Y has been issued.
$ !
$Dismount_exit:
$       dismount/nounload 'dsknam' 
$       EXIT
$
$ !
$Nolocal:
$ ! 
$ ! Here if the user claims there are no local disks that we can use.
$ !
$       IF F$SEARCH("''SDROOT'.SYSEXE>''dflt_page'") .EQS. "" THEN GOTO nol10
$       IF F$FILE("''SDROOT'.SYSEXE>''dflt_page'","ALQ") .GE. PFSIZE THEN GOTO nol20
$nol10:
$       SYSGEN CREATE 'SDROOT'.SYSEXE>'dflt_page'/SIZE='PFSIZE'
$       SET FILE 'SDROOT'.SYSEXE>'dflt_page'/NOBACKUP
$nol20:
$       IF F$SEARCH("''SDROOT'.SYSEXE>''dflt_swap'") .EQS. "" THEN GOTO nol30
$       IF F$FILE("''SDROOT'.SYSEXE>''dflt_swap'","ALQ") .GE. SWAPSIZE THEN GOTO nol40
$nol30:
$       SYSGEN CREATE 'SDROOT'.SYSEXE>'dflt_swap'/SIZE='SWAPSIZE'
$       SET FILE 'SDROOT'.SYSEXE>'dflt_swap'/NOBACKUP
$nol40:
$
$       !GOSUB prmpt_IVP
$
$ !
$ ! Write STARTUP1.COM. This STARTUP1.COM file is the one which is used
$ ! if the user is not going to have paging/swapping on the local disk.
$ ! This file does NOT wait for INSTALL_PAGE.COM to be created. It will
$ ! configure the network database, run autogen and reboot the satellite.
$ !
$       open /write f1 'sdroot'.sysexe>startup1.com
$       write f1 "$ verify = 'F$VERIFY(0)'"
$       write f1 "$ !"
$       write f1 "$RUN SYS$SYSTEM:SYSGEN"
$       write f1 "USE CURRENT"
$       write f1 "SET/START SYS$SYSTEM:STARTUP.COM"
$       write f1 "WRITE CURRENT"
$       write f1 "EXIT"
$       write f1 "$ !"
$       write f1 "$root = f$getdvi(""SYS$SYSDEVICE"",""fulldevnam"") - ""_"""
$       write f1 "$if f$trnlnm(""SYS$TOPSYS"",""LNM$SYSTEM"") .nes. """" then -"
$       write f1 "root = root + ""<"" + f$trnlnm(""SYS$TOPSYS"",""LNM$SYSTEM"") + "".>"""
$       write f1 "$define/system/exec/nolog/translation=(terminal,concealed) sys$specific 'root"
$       write f1 "      no_common_root = f$search(""SYS$SPECIFIC:<000000>SYSCOMMON.DIR"") .eqs. """"
$       write f1 "$if no_common_root then -"
$       write f1 "define/system/exec/nolog/translation=(terminal,concealed) sys$sysroot 'root"
$       write f1 "$if no_common_root then -"
$       write f1 "define/system/exec/nolog/translation=(terminal,concealed) sys$common 'root""
$       write f1 "$define/system/exec/nolog sys$sysdisk sys$sysroot:"
$       write f1 "$define/system/exec/nolog sys$errorlog sys$sysroot:<syserr>"
$       write f1 "$define/system/exec/nolog sys$examples sys$sysroot:<syshlp.examples>"
$       write f1 "$define/system/exec/nolog sys$help sys$sysroot:<syshlp>"
$       write f1 "$define/system/exec/nolog sys$instruction sys$sysroot:<syscbi>"
$       write f1 "$define/system/exec/nolog sys$library sys$sysroot:<syslib>"
$       write f1 "$define/system/exec/nolog sys$maintenance sys$sysroot:<sysmaint>"
$       write f1 "$define/system/exec/nolog sys$manager sys$sysroot:<sysmgr>"
$       write f1 "$define/system/exec/nolog sys$update sys$sysroot:<sysupd>"
$       write f1 "$define/system/exec/nolog sys$test sys$sysroot:<systest>"
$       write f1 "$define/table=lnm$system_directory/super lnm$dcl_logical lnm$file_dev"
$ !
$       write f1 "$ RUN SYS$SYSTEM:SYSGEN"
$       write f1 "AUTOCONFIGURE ALL"
$       write f1 "EXIT"
$ !
$       write f1 "$ DEFINE NETCIRC SYS$SPECIFIC:<SYSEXE>NETCIRC.DAT"
$       write f1 "$ DEFINE NETLINE SYS$SPECIFIC:<SYSEXE>NETLINE.DAT"
$       write f1 "$ DEFINE NETOBJECT SYS$SPECIFIC:<SYSEXE>NETOBJECT.DAT"
$       write f1 "$ DEFINE NETLOGING SYS$SPECIFIC:<SYSEXE>NETLOGING.DAT"
$       write f1 "$ DEFINE NETNODE_LOCAL SYS$SPECIFIC:<SYSEXE>NETNODE_LOCAL.DAT"
$       write f1 "$ DEFINE NETNODE_REMOTE SYS$SPECIFIC:<SYSEXE>NETNODE_REMOTE.DAT"
$       write f1 "$ DEFINE NETCONF SYS$SPECIFIC:<SYSEXE>NETCONF.DAT"
$       write f1 "$ IF F$SEARCH(""sys$common:<sysexe>netnode_remote.dat"") .EQS. """" THEN GOTO install"
$       write f1 "$ DEFINE NETNODE SYS$SPECIFIC:<SYSEXE>NETNODE.DAT"
$       write f1 "$INSTALL:"
$       write f1 "$ install = ""$install"""
$       write f1 "$ install sys$common:<syslib>secureshr /open/header/shared/protect"
$       write f1 "$ install sys$common:<syslib>dismntshr /open/header/shared/protect/nopurge"
$       write f1 "$ install sys$common:<syslib>mountshr /open/header/shared/protect"
$       write f1 "$ install sys$common:<sysmsg>sysmgtmsg"
$!
$! For two boot disk configurations, define cluster common file
$! SYSUAF in the satellite's startup com file. Must 
$! do after mountshr installation.
$!
$       vol_label = F$GETDVI("''SYSUAF_DISK'","VOLNAM")
$       write f1 "$if .not. F$GETDVI(""''SYSUAF_DISK'"",""MNT"") then -"
$       write f1 " mount/system ''sysuaf_disk' ''vol_label'"
$       write f1 "$define/system/exec/nolog sysuaf ''sysuaf_file'"
$!
$!
$       write f1 "$ Write sys$output ""Configuring network..."""
$       write f1 "$ @SYS$MANAGER:NETCONFIG ''scsnode' ''scssystemid' NO NO YES"
$       write f1 "$ ncp =""$ncp"""
$       write f1 "$ ncp define executor alias incoming disabled"
$       write f1 "$ ncp purge known logging known events"
$ if F$TRNLNM("NETNODE_REMOTE") .eqs. "" THEN GOTO Cont_startup2
$       write f1 "$ delete/nolog sys$specific:<sysexe>netnode_remote.dat;*"
$       write f1 "$ goto norem"
$ Cont_startup2:
$       write f1 "$ IF F$SEARCH(""sys$specific:<sysexe>netnode_remote.dat"") .EQS."""" THEN GOTO norem"
$       write f1 "$ IF F$SEARCH(""sys$common:<sysexe>netnode_remote.dat"") .EQS. """" THEN GOTO norem"
$       write f1 "$ delete/nolog sys$specific:<sysexe>netnode_remote.dat;*"
$       write f1 "$NOREM:"
$ !
$       IF run_ivp .EQS. "YES" THEN GOTO need_ivp2
$       write f1 "$ @SYS$COMMON:<sysupd>AUTOGEN GETDATA REBOOT INITIAL"
$       GOTO close_file2
$ !
$ ! If we're running the IVP then we must not let AUTOGEN do the REBOOT
$ ! since AUTOGEN will automatically reset the startup file to SYS$SYSTEM:
$ ! STARTUP.COM. (bug in AUTOGEN).
$ !
$Need_ivp2:
$       write f1 "$ @SYS$COMMON:<sysupd>AUTOGEN GETDATA SETPARAMS INITIAL"
$       write f1 "$ !"
$       write f1 "$RUN SYS$SYSTEM:SYSGEN"
$       write f1 "USE CURRENT"
$       write f1 "SET/START SYS$SYSTEM:IVP_STARTUP.COM"
$       write f1 "WRITE CURRENT"
$       write f1 "EXIT"
$       write f1 "$ !"
$       write f1 "$ @sys$system:shutdown ""0"" ""Reboot system with AUTOGENerated parameters"" ""N"" -"
$       write f1 """Y"" ""soon"" ""Y"" ""REBOOT_CHECK"""
$
$Close_file2:
$       write f1 "$ verify = 'F$VERIFY(verify)'"
$       close f1
$ !
$       open /write f1 sys$scratch:gen_node.tmp
$       write f1 "$ RUN SYS$SYSTEM:SYSGEN"
$       write f1 "USE ''SDROOT'.SYSEXE>VAXVMSSYS.PAR"
$       write f1 "SET /START SYS$SYSTEM:STARTUP1.COM"
$       write f1 "WRITE ''SDROOT'.SYSEXE>VAXVMSSYS.PAR"
$       write f1 "EXIT"
$       write f1 "$ EXIT 1"
$       close f1
$       @sys$scratch:gen_node.tmp
$       delete/nolog sys$scratch:gen_node.tmp;*
$       say "The satellite configuration procedure has successfully completed."
$       type sys$input

    This node has been configured to allow the satellite node to 
    join this cluster.

    The first time the satellite node boots, "NETCONFIG" and
    "AUTOGEN" will run automatically.

$       EXIT 1
$ !
$ !
$ ! Remove a satellite node.
$ !
$Remnode:
$ !
$ ! Verify that this system is set up to be a cluster.
$ !
$       if f$trnlnm("SYS$SPECIFIC") .eqs. f$trnlnm("SYS$COMMON") then goto notcdisk
$       if f$getsyi("VAXCLUSTER") .eq. 0 then goto notcluster
$ !
$ ! Tell the user what REMOVE does.
$ !
$       type SYS$INPUT

    The REMOVE command disables a satellite node by:

            o deleting its root directory tree.

            o removing its remote booting information
              from the network database.

$ !
$ ! Prompt for the disk name.
$ ! 
$Prmpt_disk_rem:
$       ask disk "What is the device name for the system root [''sd']? "
$       IF disk .EQS. "" THEN disk = sd
$       disk = disk - ":"
$       disk = disk + ":"
$       IF .NOT. F$GETDVI("''disk'", "EXISTS") THEN GOTO baddisk_rem
$       IF .NOT. F$GETDVI("''disk'", "AVL") THEN GOTO baddisk_rem
$       IF .NOT. F$GETDVI("''disk'", "MNT") THEN GOTO baddisk_rem
$       sd = disk
$ !
$ ! Get a valid system root name.
$ !
$       skip_net = 0
$       root = ""
$Get_root_rem:
$       IF root .NES. "" THEN GOTO chk_root_rem
$       ask root "What is the name of the system root? "
$Chk_root_rem:
$       remove_flg = 1
$       GOSUB check_root
$       IF root .EQS. "" THEN GOTO get_root_rem
$ !
$ ! Get a valid node name.
$ !
$       GOSUB get_node_sub
$ !
$ ! Make sure the node name is associated with the specified root.
$ !
$       IF F$SEARCH("sys$scratch:gen_node.tmp") .EQS. "" THEN GOTO notmp_rem
$       delete/nolog sys$scratch:gen_node.tmp;*
$Notmp_rem:
$       say "Verifying network database..."
$       IF F$SEARCH("sys$scratch:satellite_ncp.tmp") .NES. "" THEN -
         delete/nolog sys$scratch:satellite_ncp.tmp;*
$       define/user sys$output nl:
$       define/user sys$error nl:
$       ncp list node 'scsnode char to sys$scratch:gen_node.tmp
$       open/read tempfile sys$scratch:gen_node.tmp/error=nonode
$       fnd_node = 0
$       fnd_root = 0
$Getdata_rem1:
$       READ/END_OF_FILE=getdata_rem2 tempfile record
$       IF fnd_node .EQ. 1 THEN GOTO locroot_rem
$       IF F$LOCATE("''scsnode'",record) .EQ. F$LENGTH(record) THEN GOTO getdata_rem1
$       fnd_node = 1
$Locroot_rem:
$       IF F$LOCATE("''root'",record) .EQ. F$LENGTH(record) THEN GOTO getdata_rem1
$       fnd_root = 1
$Getdata_rem2:
$       CLOSE tempfile
$       DELETE/NOLOG sys$scratch:gen_node.tmp;*
$       IF fnd_node .EQ. 0 THEN GOTO nonode
$       IF fnd_root .EQ. 0 THEN GOTO notroot
$
$       IF F$GETSYI("CLUSTER_MEMBER",scsnode) THEN GOTO nodeup
$
$CLEANUP_D_ROOT:
$       sdroot = sd + "<" + root + ">"
$       GOSUB del_root
$ !
$ ! Fix up network database.
$ !
$       IF skip_net .EQ. 1 THEN GOTO exit_rem
$Fixdata:
$       say "Updating network database..."
$       IF F$SEARCH("sys$scratch:satellite_ncp.tmp") .NES. "" THEN -
         delete/nolog sys$scratch:satellite_ncp.tmp;*
$       open/write gennode$file  sys$scratch:gen_node.tmp
$       write gennode$file "$ define/user sys$output nl:"
$       write gennode$file "$ define/user sys$error sys$scratch:satellite_ncp.tmp"
$       write gennode$file  "$ run sys$system:ncp"
$       write gennode$file  "    purge node ",scsnode," hardware address"
$       write gennode$file  "    purge node ",scsnode," load assist agent"
$       write gennode$file  "    purge node ",scsnode," load assist parameter"
$       write gennode$file  "    clear node ",scsnode," hardware address"
$       write gennode$file  "    clear node ",scsnode," load assist agent"
$       write gennode$file  "    clear node ",scsnode," load assist parameter"
$       close gennode$file 
$       @sys$scratch:gen_node.tmp
$       delete/nolog sys$scratch:gen_node.tmp;*
$       GOSUB chk_ncp_errs
$       IF error_flag .EQ. 0 THEN EXIT
$       GOSUB unsave_ncp
$Exit_rem:
$       say "The satellite configuration procedure has successfully completed."
$       EXIT 1
$
$Baddisk_rem:
$       say "Invalid disk."
$       GOTO prmpt_disk_rem
$
$Nodeup:
$       say "Node ''SCSNODE' is a member of the cluster. Please bring down ''SCSNODE'"
$       say "before running this procedure."
$       EXIT
$
$Nonode:
$       say "Node ''SCSNODE' does not exist in the permanent network database."
$       GOTO askproc
$
$Notroot:
$       say "Root ''ROOT' is not associated with node ''SCSNODE'."
$
$Askproc:
$       ask proceed "Do you still want to delete the entire directory ''ROOT' [NO]? "
$       IF proceed .EQS. "" THEN EXIT
$       IF F$LOCATE(proceed,"YES") .NE. 0 THEN EXIT
$       skip_net = 1
$       GOTO cleanup_d_root
$       EXIT
$
$ !
$ !
$ ! Modify the network database.
$ !
$Modnode:
$       hdwaddr = ""
$       scsid = ""
$       disk = ""
$       root = ""
$       satroot = ""
$       datalink = ""
$       laa = ""
$       scssystemid = ""
$ !
$ ! Get a valid node name.
$ !
$       GOSUB get_node_sub
$
$ !
$ ! Make sure the remote booting info. is set up for this node.
$ !
$       IF F$SEARCH("sys$scratch:gen_node.tmp") .EQS. "" THEN GOTO notmp_mod
$       delete/nolog sys$scratch:gen_node.tmp;*
$notmp_mod:
$       IF F$SEARCH("sys$scratch:satellite_ncp.tmp") .NES. "" THEN -
         delete/nolog sys$scratch:satellite_ncp.tmp;*
$       define/user sys$output nl:
$       define/user sys$error sys$scratch:satellite_ncp.tmp
$       ncp list node 'scsnode char to sys$scratch:gen_node.tmp
$       GOSUB chk_ncp_errs
$       IF error_flag .EQ. 0 THEN EXIT
$       open/read tempfile sys$scratch:gen_node.tmp
$       fnd_node = 0
$Read_next_line:
$       read tempfile  line -
        /end_of_file=no_more
$       line = F$EDIT(line,"TRIM,COMPRESS,UPCASE")
$       IF F$LOCATE("(''scsnode')",line) .NE. F$LENGTH(line) THEN GOTO scs_id
$       IF F$LOCATE("HARDWARE ADDRESS",line) .NE. F$LENGTH(line) THEN GOTO hdwr_addr
$       IF F$LOCATE("ASSIST PARAMETER",line) .NE. F$LENGTH(line) THEN GOTO satell_root
$       IF F$LOCATE("SERVICE CIRCUIT",line) .NE. F$LENGTH(line) THEN GOTO serv_circ
$       IF F$LOCATE("ASSIST AGENT",line) .NE. F$LENGTH(line) THEN GOTO load_agent
$       GOTO read_next_line
$Scs_id:
$       IF F$LOCATE("=",line) .EQ. F$LENGTH(line) THEN GOTO read_next_line
$       line = F$EXTRACT(F$LOCATE("=",line)+1,999,line)
$       IF F$EXTRACT(0,1,line) .NES. " " THEN GOTO scs20
$       line = F$EXTRACT(1,999,line)
$Scs20:
$       fnd_node = 1
$       scsid = F$EXTRACT(0,F$LOCATE(" ",line),line)
$       GOTO read_next_line
$Hdwr_addr:
$       IF F$LOCATE("=",line) .EQ. F$LENGTH(line) THEN GOTO read_next_line
$       line = F$EXTRACT(F$LOCATE("=",line)+1,999,line)
$       IF F$EXTRACT(0,1,line) .NES. " " THEN GOTO hdwr20
$       line = F$EXTRACT(1,999,line)
$Hdwr20:
$       hdwaddr = F$EXTRACT(0,999,line)
$       GOTO read_next_line
$Satell_root:
$       IF F$LOCATE("=",line) .EQ. F$LENGTH(line) THEN GOT read_next_line
$       disk = F$EXTRACT(F$LOCATE("=",line)+1,999,line)
$       disk = F$EDIT(disk,"TRIM")
$       disk = F$EXTRACT(0,F$LOCATE(":",disk)+1,disk)
$ ! 
$ ! Allow either angle or square brackets.
$ !
$       IF F$LOCATE("[",line) .EQ. F$LENGTH(line) THEN GOTO check_angle
$       line = F$EXTRACT(F$LOCATE("[",line)+1,999,line)
$       GOTO skip_angle
$Check_angle:
$       IF F$LOCATE("<",line) .EQ. F$LENGTH(line) THEN GOTO read_next_line
$       line = F$EXTRACT(F$LOCATE("<",line)+1,999,line)
$Skip_angle:
$       IF F$EXTRACT(0,1,line) .NES. " " THEN GOTO sat20
$       line = F$EXTRACT(1,999,line)
$Sat20:
$       satroot = F$EXTRACT(0,F$LOCATE(".",line),line)
$       GOTO read_next_line
$Serv_circ:
$       IF F$LOCATE("=",line) .EQ. F$LENGTH(line) THEN GOTO read_next_line
$       line = F$EXTRACT(F$LOCATE("=",line)+1,999,line)
$       IF F$EXTRACT(0,1,line) .NES. " " THEN GOTO svc20
$       line = F$EXTRACT(1,999,line)
$Svc20:
$       datalink = F$EXTRACT(0,999,line)
$       GOTO read_next_line
$Load_agent:
$       laa = "exists"
$       GOTO read_next_line
$No_more:
$       close tempfile 
$       delete/nolog sys$scratch:gen_node.tmp;*
$       IF fnd_node .EQ. 0 THEN GOTO nonode_mod
$       IF (hdwaddr .EQS. "") .OR. (satroot .EQS. "") .OR. (datalink .EQS. "") .OR. -
        (laa .EQS. "") THEN GOTO invdatabase_mod
$       fnd_one = 0
$Get_hdw_mod:
$       ask num "What is the new hardware address [''hdwaddr']? "
$       IF num .EQS. "" THEN GOTO mod_data_base
$       GOSUB check_hdwaddr
$       IF num .EQS. "" THEN GOTO get_hdw_mod
$       fnd_one = 1
$Mod_data_base:
$       IF fnd_one .EQ. 0 THEN GOTO leave_mod
$ !
$ ! Modify the network database.
$ !
$       say "Updating network database..."
$       GOSUB unsave_ncp
$       IF F$SEARCH("sys$scratch:satellite_ncp.tmp") .NES. "" THEN -
         delete/nolog sys$scratch:satellite_ncp.tmp;*
$       open/write gennode$file  sys$scratch:gen_node.tmp
$       write gennode$file "$ define/user sys$output nl:"
$       write gennode$file "$ define/user sys$error sys$scratch:satellite_ncp.tmp"
$       write gennode$file  "$ run sys$system:ncp"
$       IF num .NES. "" THEN -
            write gennode$file  " define node ",scsnode," hardware address ",num
$       write gennode$file  " set node ",scsnode," all"
$       close gennode$file 
$       @sys$scratch:gen_node.tmp
$       delete/nolog sys$scratch:gen_node.tmp;*
$       GOSUB chk_ncp_errs
$       IF error_flag .EQ. 0 THEN EXIT
$       IF num .EQS. "" THEN num = hdwaddr
$       IF root .EQS. "" THEN sdroot = sd + "<" + satroot
$       saved_scsid = scssystemid
$       IF scssystemid .EQS. "" THEN scssystemid = scsid
$       GOSUB save_ncp
$
$ !
$ ! If the SCSSYSTEMID was changed then make sure VAXVMSSYS.PAR and
$ ! MODPARAMS.DAT in the satellite's root directory get updated.
$ !
$       IF saved_scsid .EQS. "" THEN GOTO leave_mod
$       IF root .NES. "" THEN satroot = root
$       satroot_dir = sd + "<" + satroot + ".SYSEXE>"
$       IF F$SEARCH("''satroot_dir'MODPARAMS.DAT") .EQS. "" THEN GOTO chk_vaxvms
$       OPEN/APPEND f1 'satroot_dir'MODPARAMS.DAT
$       WRITE f1 "SCSSYSTEMID=''expanded_id'"
$       CLOSE f1
$
$Chk_vaxvms:
$       IF F$SEARCH("''satroot_dir'VAXVMSSYS.PAR") .EQS. "" THEN GOTO leave_mod
$       open /write f1 sys$scratch:gen_node.tmp
$       write f1 "$ RUN SYS$SYSTEM:SYSGEN"
$       write f1 "USE ''satroot_dir'VAXVMSSYS.PAR"
$       write f1 "SET SCSSYSTEMID ''expanded_id'"
$       write f1 "WRITE ''satroot_dir'VAXVMSSYS.PAR"
$       write f1 "EXIT"
$       write f1 "$ EXIT 1"
$       close f1
$       @sys$scratch:gen_node.tmp
$       delete/nolog sys$scratch:gen_node.tmp;*
$
$Leave_mod:
$       say "The satellite configuration procedure has successfully completed."
$       EXIT
$
$Baddisk_mod:
$       say "Invalid disk."
$       GOTO get_disk_mod
$
$Nonode_mod:
$       say "Node ''SCSNODE' does not exist in the permanent network database."
$       EXIT
$Invdatabase_mod:
$       say "The permanent network database for ''SCSNODE' is not set up for remote booting."
$       EXIT
$
$ !
$ !
$ ! Beginning of Subroutines
$ !
$CHECK_ROOT:
$ !
$ ! This subroutine validates the root name. It verifies that the root
$ ! does/doesn't already exist, it is not the system root and it is a valid
$ ! root name.
$ !
$ ! INPUTS:
$ !     root - root name
$ !     remove_flg -  0 indicates we're adding a root so root must NOT exist
$ !                   1 indicates we're removing a root so root must exist
$ !
$ ! OUTPUTS:
$ !     error - the error is output and ROOT is set to ""
$ !     success - ROOT is not touched
$ !
$       if root .eqs. "" then goto inv_root
$       root = root - "[" - "]" - "<" - ">"
$       root = f$edit(root,"COLLAPSE,UPCASE")
$       if root .eqs. f$trnlnm("SYS$TOPSYS") then goto runningroot
$       if f$ext(0,3,root) .nes. "SYS" then goto inv_root
$       if f$len(root) .ne. 4 then goto inv_root
$       t1 = f$ext(3,1,root)
$       if (t1 .ges. "0") .and. (t1 .les. "9") then goto ckr10
$       if (t1 .lts. "A") .or. (t1 .gts. "D") then goto inv_root
$CKR10:
$       if f$parse("''sd'<000000>''root'.dir") .eqs. "" then goto inv_root
$       if remove_flg .eq. 0 then -
        if f$search("''sd'<000000>''root'.dir") .nes. "" then goto rootxist
$       if remove_flg .ne. 0 then -
        if f$search("''sd'<000000>''root'.dir") .eqs. "" then goto noroot
$       RETURN
$
$GET_ROOT1:
$       root = ""
$       RETURN
$ !
$ ! Here if invalid root name
$ !
$Inv_root:
$       say "Invalid root name."
$       GOTO get_root1
$ !
$ ! Here if root already exists.
$ !
$ROOTXIST:
$       say "Root ''ROOT' already exists."
$       GOTO get_root1
$ !
$ ! Here if root does not exist.
$ !
$Noroot:
$       say "Root ''ROOT' does not exist."
$       GOTO get_root1
$ !
$ ! Here if the running system root.
$ !
$RUNNINGROOT:
$       say "''ROOT' is the root of the currently running system."
$       GOTO get_root1
$ !
$GET_NODE_SUB:
$ !
$ ! This subroutine prompts the user for the node name and validates it.
$ !
$ ! INPUTS:
$ !     none
$ !
$ ! OUTPUTS:
$ !     SCSNODE - contains a valid node name
$ !
$       scsnode = ""
$GET_NODE:
$       if scsnode .nes. "" then goto check_node
$       ask scsnode "What is the DECnet node name of the satellite node? "
$       goto get_node
$CHECK_NODE:
$       t1 = f$length(scsnode)
$       if t1 .gt. 6 then goto inv_nodename
$ ! 
$ ! Name must begin with an alphanumeric character.
$ !
$       t1 = f$edit(scsnode,"trim,upcase")
$       t1 = f$extract(0,1,t1)
$       if (t1 .lts. "A") .or. (t1 .gts. "Z") then goto inv_nodename
$       RETURN
$ !
$ ! Invalid node name
$ !
$INV_NODENAME:
$       say "''scsnode' is an invalid node name."
$       GOTO get_node_sub
$ !
$VERIFY_NODE:
$ !
$ ! This subroutine verifies that the node is not already set up for
$ ! remote booting.
$ ! INPUTS:
$ !     scsnode - DECnet node name
$ !
$ ! OUTPUTS:
$ !     Prints a message to the user and EXITS if the node is set up for
$ !      remote booting.
$ !
$       IF F$SEARCH("sys$scratch:gen_node.tmp") .EQS. "" THEN GOTO notmp_veri
$       delete/nolog sys$scratch:gen_node.tmp;*
$notmp_veri:
$       define/user sys$output nl:
$       define/user sys$error nl:
$       ncp list node 'scsnode char to sys$scratch:gen_node.tmp
$       open/read tempfile sys$scratch:gen_node.tmp/error=no_assist
$Read_next_record:
$       read tempfile record/end_of_file=no_assist
$       record = F$EDIT(record,"TRIM,COMPRESS,UPCASE")
$       IF F$LOCATE("ASSIST AGENT",record) .NE. F$LENGTH(record) THEN GOTO assist_agent
$       GOTO read_next_record
$No_assist:
$       close tempfile 
$       delete/nolog sys$scratch:gen_node.tmp;*
$       RETURN
$ !
$ ! If the Load Assist Agent was found then the node is already set up for
$ ! remote booting. Tell the user and exit if this is the case.
$ !
$Assist_agent:
$       close tempfile 
$       delete/nolog sys$scratch:gen_node.tmp;*
$       Say "''scsnode' is already configured to be a satellite node."
$       EXIT
$ !
$CHECK_ID:
$ !
$ ! This subroutine validates the DECnet node address. It verifies that the
$ ! address is a valid address. It also calculates what the real scssystemid is.
$ !
$ ! INPUTS:
$ !     scssystemid - DECnet node address
$ !
$ ! OUTPUTS:
$ !     error - the error is output and SCSSYSTEMID is set to ""
$ !     success - SCSSYSTEMID is not touched
$ !               expanded_id is set to the real SCSSYSTEMID
$ !
$       loc_addr = scssystemid
$       IF F$LOCATE(".",scssystemid) .GE. F$LENGTH(scssystemid) THEN GOTO bad_addr
$       tmp = F$LOCATE(".",scssystemid)
$       loc_area = F$EXTRACT(0,tmp,scssystemid)
$       tmp = tmp + 1
$       loc_addr = F$EXTRACT(tmp,999,scssystemid)
$       IF loc_area .GT. 63 THEN GOTO bad_addr
$       IF loc_area .LT. 1 THEN GOTO bad_addr
$Got_loc:
$       IF loc_addr .GT. 1023 THEN GOTO bad_addr
$       IF loc_addr .LT. 1 THEN GOTO bad_addr
$       expanded_id = (loc_area*1024) + loc_addr
$       RETURN
$BAD_ADDR:
$       WRITE SYS$OUTPUT "''scssystemid' is not a legal DECnet node address."
$       WRITE SYS$OUTPUT "Legal node address range is 1.1 - 63.1023"
$       scssystemid = ""
$       RETURN
$ !
$CHECK_HDWADDR:
$ !
$ ! This subroutine validates the hardware address. 
$ !
$ ! INPUTS:
$ !     num - Ethernet Hardware Address
$ !
$ ! OUTPUTS:
$ !     error - the error is output and NUM is set to ""
$ !     success - NUM is not touched
$ !
$       t1=0
$       IF F$LENGTH(num) .NE. 17 THEN GOTO invalidnum
$       indx = 0
$Checkaddr:
$       IF (indx .EQ. (5*3)) THEN GOTO lastpair
$       t2 = F$EXT(indx+2,1,num)
$       IF t2 .NE. "-" THEN GOTO invalidnum
$Lastpair:
$       t3 = F$EXT(indx,1,num)
$       IF (t3 .GES. "0") .AND. (t3 .LES. "9") THEN GOTO nextnum
$       IF (t3 .GES. "A") .AND. (t3 .LES. "F") THEN GOTO nextnum
$       IF (t3 .GES. "a") .AND. (t3 .LES. "f") THEN GOTo nextnum
$       GOTO invalidnum
$Nextnum:
$       t3 = F$EXT(indx+1,1,num)
$       IF (t3 .GES. "0") .AND. (t3 .LES. "9") THEN GOTO validhex
$       IF (t3 .GES. "A") .AND. (t3 .LES. "F") THEN GOTO validhex
$       IF (t3 .GES. "a") .AND. (t3 .LES. "f") THEN GOTO validhex
$       GOTO invalidnum
$Validhex:
$       IF indx .EQ. (5*3) THEN RETURN
$       indx = indx + 3
$       GOTO checkaddr
$Invalidnum:
$       say "Invalid hardware address"
$       num = ""
$       RETURN
$ !
$DEL_ROOT:
$ !
$ ! This subroutine deletes the root directory.
$ !
$ ! INPUTS:
$ !     sdroot = sd + "<" + root + ">"
$ !
$ ! OUTPUTS:
$ !     none
$ !
$       say "Deleting directory tree ''ROOT'..."
$       sdroot = sd + "<" + root - ">"
$       if f$search("''sd'<''root'>syscommon.dir") .nes. "" then -
        set file /remove 'sdroot'>syscommon.dir;*
$       if f$search("''sd'<''root'.sysexe>sysboot.exe") .nes. "" then -
        set file /remove 'sdroot'.sysexe>sysboot.exe;*
$
$       stream_id = 0
$Dele_rem:
$       stream_id = stream_id + 1
$       IF F$SEARCH("''sd'<''root'...>*.*;*",'stream_id) .EQS. "" THEN GOTO fini_rem
$       DELETE 'F_LOG' 'sdroot'...>*.*;*
$       GOTO dele_rem
$
$Fini_rem:
$       if f$search("''sd'<0,0>''root'.dir") .nes. "" then Delete 'F_LOG' 'sd'<0,0>'root'.dir;*
$       sdroot = sd + "<" + root + ">"
$       say "System root ''ROOT' deleted."
$       RETURN
$ !
$ !
$CHK_NCP_ERRS:
$ !
$ ! This subroutine searches the file sys$scratch:satellite_ncp.tmp for
$ ! %NCP errors.
$ !
$ ! INPUTS:
$ !     SYS$SCRATCH:SATELLITE_NCP.TMP
$ !
$ ! OUTPUTS:
$ !     error_flag is set to 1 on success
$ !     error_flag is set to 0 on error
$ !
$ ! Side Effects:
$ !     Deletes sys$scratch:satellite_ncp.tmp.
$ !
$
$       IF F$SEARCH("sys$scratch:satellite_ncp.tmp") .EQS. "" THEN RETURN
$       open/read chkncp sys$scratch:satellite_ncp.tmp/error=chk_ncp_rtn
$Chk_ncp_errs1:
$       READ/END_OF_FILE=chk_ncp_rtn chkncp record
$       record = F$EDIT(record,"UPCASE")
$       IF F$LOCATE("%NCP-E",record) .NE. F$LENGTH(record) THEN GOTO ncp_err_fnd
$       IF F$LOCATE("%NCP-F",record) .NE. F$LENGTH(record) THEN GOTO ncp_err_fnd
$       IF F$LOCATE("%NCP-I",record) .NE. F$LENGTH(record) THEN GOTO ncp_err_fnd
$       IF F$LOCATE("%NCP-W",record) .NE. F$LENGTH(record) THEN GOTO ncp_err_fnd
$       GOTO CHK_NCP_ERRS1
$
$Ncp_err_fnd:
$       error_flag = 0
$       close chkncp
$       say "The following error occurred while updating the network database:"
$       say ""
$       type sys$scratch:satellite_ncp.tmp
$       delete/nolog sys$scratch:satellite_ncp.tmp;*
$       say ""
$       say "Please correct the problem and reinvoke this command procedure."
$       RETURN
$
$Chk_ncp_rtn:
$       error_flag = 1
$       close chkncp
$       delete/nolog sys$scratch:satellite_ncp.tmp;*
$       RETURN
$ !
$ !
$GET_SPEC:
$ !
$ ! This subroutine prompts the user for the file specification for either
$ ! the page file or swap file. After validating the file spec., it creates
$ ! the page/swap file on the satellite's local disk.
$ !
$ ! INPUTS:
$ !     pagswp - Either "page" or "swap"
$ !     dsknam - Satellite's local disk where page/swap file will reside
$ !     dflt_locdir  - The default directory
$ !     dflt_spec - The default file spec.
$ !     scsnode - Satellite node name
$ !     size - size of file to be created
$ !
$ ! OUTPUTS:
$ !     lvolnam - set to logical volume name
$ !     If pagswp is "page" then page_file get the full file spec else
$ !         swap_file gets the full file spec.  
$ !
$       mount /noassist/data_check=(read,write)/over=id 'dsknam'
$ !
$ ! Make sure we dismount the disk if we get an error at this point
$ !
$       ON ERROR THEN GOTO DISMOUNT_EXIT
$       ON CONTROL_Y THEN GOTO DISMOUNT_EXIT
$
$       lvolnam = F$GETDVI("''dsknam'","VOLNAM")
$       dir_fil = F$SEARCH("''dsknam':<*...>''dflt_spec'")
$       IF dir_fil .EQS. "" THEN GOTO prmpt_spec
$       dflt_locdir = F$PARSE("''dir_fil'",,,"DIRECTORY","SYNTAX_ONLY")
$       say ""
$       say "''dflt_spec' already exists on ''dsknam':"
$       say ""
$       say "****************************************"
$       dir 'dsknam':<*...>'dflt_spec'/siz=all/nodate/version=1
$       say ""
$       say "****************************************"
$Prmpt_spec:
$       say ""
$       say "What is the file specification for the ''pagswp'file on
$       ask file_spec "''dsknam': [ ''dflt_locdir'''dflt_spec' ]? "
$       full_spec = F$PARSE("''file_spec'","''scsnode'::''dsknam':''dflt_locdir'''dflt_spec'",,,"SYNTAX_ONLY")
$       IF full_spec .EQS. "" THEN GOTO bad_spec
$       node_spec = F$PARSE("''full_spec'",,,"NODE","SYNTAX_ONLY")
$       IF node_spec .NES. ("''scsnode'" + "::") THEN GOTO bad_node 
$       dev_spec = F$PARSE("''full_spec'",,,"DEVICE","SYNTAX_ONLY")
$       IF dev_spec .NES. ("''dsknam'" + ":") THEN GOTO bad_dev
$       full_spec = full_spec - node_spec - dev_spec
$       dir_spec = F$PARSE("''full_spec'",,,"DIRECTORY","SYNTAX_ONLY")
$       dir_spec = dir_spec - "<" - ">" - "[" - "]"
$
$       IF F$SEARCH("''dsknam':<000000>''dir_spec'.DIR") .EQS. "" THEN -
        create/directory/log 'dsknam':<'dir_spec'>/own=<1,4>
$ !
$ ! If a page/swap file already exists in this directory and it
$ ! is at least the size that the user specified then don't create
$ ! another page/swap file.
$ !
$       IF F$SEARCH("''dsknam':''full_spec'") .EQS. "" THEN GOTO sysgen_create
$       say "This procedure will use the existing ''pagswp'file,"
$       say "''dsknam':''full_spec'."
$       IF size .LE. (F$FILE_ATTRIBUTES("''dsknam':''full_spec'","EOF")) THEN -
                GOTO skip_create
$       alqsiz = F$FILE_ATTRIBUTES("''dsknam':''full_spec'","ALQ")
$       IF size .EQ. alqsiz THEN GOTO skip_create
$Ask_extend:
$       say "You have requested a ''pagswp'file size of ''size' and the existing"
$       say "''pagswp'file size is ''alqsiz'."
$       ask ext "Do you want this procedure to try to extend this file [NO]? "
$       IF ext .EQS. "" THEN GOTO no_extend
$       IF F$LOCATE(ext,"NO") .EQ. 0 THEN GOTO no_extend
$       IF F$LOCATE(ext,"YES") .EQ. 0 THEN GOTO sysgen_create
$       say "Invalid response."
$       GOTO ask_extend
$No_extend:
$       IF pagswp .EQS. "page" THEN min_siz = min_pfsize
$       IF pagswp .EQS. "swap" THEN min_siz = min_swpsize
$       IF alqsiz .GE. min_siz THEN GOTO skip_warn
$       say "WARNING - The current ''pagswp'file size is less than the recommended"
$       say "          ''pagswp'file size of ''min_siz'."
$Skip_warn:
$       size = alqsiz
$       GOTO skip_create
$
$Sysgen_create:
$       sysgen create 'dsknam':'full_spec'/size='size'
$ !
$ ! SYSGEN will just produce an informational message if it cannot
$ ! extend the file. Therefore, I check to make sure that the file
$ ! is at least the size that was specified.
$ ! 
$Skip_create:
$       IF pagswp .EQS. "page" THEN page_file = dsknam + ":" + full_spec 
$       IF pagswp .EQS. "swap" THEN swap_file = dsknam + ":" + full_spec 
$
$       actsiz = 0
$       IF F$SEARCH("''dsknam':''full_spec'") .NES. "" THEN -
         actsiz = F$FILE_ATTRIBUTES("''dsknam':''full_spec'","ALQ")
$       IF actsiz .GE. size THEN GOTO ret_get_spec 
$       say "WARNING - The requested ''pagswp'file size could not be met."
$       say "          The current ''pagswp'file size is ''actsiz'."
$Ret_get_spec:
$       dismount/nounload 'dsknam' 
$       
$       ON ERROR THEN EXIT
$       ON CONTROL_Y THEN EXIT
$
$       RETURN
$
$Bad_spec:
$       say "Invalid file specification."
$       GOTO prmpt_spec
$Bad_node:
$       say "Node must be ''scsnode'."
$       GOTO prmpt_spec
$Bad_dev:
$       say "Device must be ''dsknam'."
$       GOTO prmpt_spec
$ !
$ !
$Prmpt_IVP:
$ !
$ ! This subroutine asks the user whether they want to run the
$ ! Installation Verification Procedure(IVP).
$ !
$ ! INPUTS:
$ !     none
$ !
$ ! OUTPUTS:
$ !     run_ivp = "NO" (If user does not want to run IVP)
$ !     run_ivp = "YES" (If user wants to run IVP)
$ !
$       ask run_ivp "Do you want the Installation Verification Procedure to be run [YES]? "
$       IF run_ivp .EQS. "" THEN run_ivp = "YES"
$       IF F$LOCATE(run_ivp,"NO") .EQ. 0 THEN GOTO no_ivp
$       IF F$LOCATE(run_ivp,"YES") .EQ. 0 THEN GOTO yes_ivp
$       say "Invalid response."
$       GOTO prmpt_IVP
$
$No_ivp:
$       run_ivp = "NO"
$       RETURN
$Yes_ivp:
$       run_ivp = "YES"
$       RETURN
$ !
$ !
$Save_ncp:
$ !
$ ! This subroutine searches for the file sys$manager:netnode_update.com.
$ ! If the file is found, this routine will append the NCP commands for
$ ! remote booting the satellite node. If the file is not found, the file
$ ! will be created, "run sys$system:ncp" will be added along with the remote
$ ! booting information for the satellite node.
$ !
$ !
$ ! INPUTS:
$ !     scsnode - satellite node name
$ !     scssystemid - system id of satellite node
$ !     sdroot - root of satellite node
$ !     datalink - data link on which this satellite is connected
$ !
$ ! OUTPUTS:
$ !     none
$ !
$ ! Side Effects:
$ !     sys$manager:netnode_update.com will be created or modified.
$ !
$       lclnoddef = "SYS$MANAGER:NETNODE_UPDATE.COM"
$       IF F$TRNLNM ("NETNODE_UPDATE") .NES. "" THEN lclnoddef = "NETNODE_UPDATE"
$       IF F$SEARCH("''lclnoddef'") .NES. "" THEN GOTO app_defn
$       open/write gennode$file 'lclnoddef'
$       write gennode$file "$ run sys$system:ncp"
$       GOTO save_defn
$App_defn:
$       open/append gennode$file 'lclnoddef'
$Save_defn:
$       write gennode$file "    define node ",scsnode," address ",scssystemid
$       write gennode$file "    define node ",scsnode," hardware address ",num
$       write gennode$file "    define node ",scsnode," load assist agent sys$share:niscs_laa.exe"
$       write gennode$file "    define node ",scsnode," load assist parameter ",sdroot,".>"
$       write gennode$file "    define node ",scsnode," service circuit ",datalink
$       close gennode$file
$       RETURN
$ !
$FIND_LOGICALS:
$ !
$ ! This subroutine finds the cluster common file needed by the satellite's
$ ! startup routine by first searching through the logicals set up by the
$ ! system manager and then, if none have been set up, look for the file
$ ! in SYS$SYSTEM:
$ !
$ ! INPUTS:
$ !     lnm = logical name were trying to find a file for.
$ !
$ ! OUTPUTS:
$ !     log_disk - Disk that the file was found on.
$ !     full_file_spec - If file is found, this returns the full file name.
$ !
$
$find_logical:
$       lnm = lnm - ":"
$       full_file_spec = F$PARSE("''LNM'",,,,"no_conceal")
$       full_file_spec = F$SEARCH("''full_file_spec'")
$       if full_file_spec .nes. "" then goto parse_disk
$       full_file_spec = F$SEARCH("''disk'[V4COMMON.SYSEXE]''lnm'.DAT")
$       if full_file_spec .nes. "" then goto parse_disk
$       full_file_spec = F$SEARCH("''disk'[V4COMMON.SYSEXE]''lnm'")
$       if full_file_spec .nes. "" then goto parse_disk
$       say "Unable to locate file ''lnm'.DAT. "
$       EXIT
$parse_disk:
$       log_disk = F$PARSE("''full_file_spec'",,,"device","no_conceal")
$       RETURN
$ !
$ !
$Unsave_ncp:
$ !
$ ! This subroutine searches for the file sys$manager:netnode_update.com.
$ ! If the file is found, this routine will delete the NCP commands for
$ ! remote booting the satellite node. If the file is not found, an error
$ ! will be displayed.
$ !
$ !
$ ! INPUTS:
$ !     scsnode - satellite node name
$ !     scssystemid - system id of satellite node
$ !     sdroot - root of satellite node
$ !     datalink - data link on which this satellite is connected
$ !
$ ! OUTPUTS:
$ !     none
$ !
$ ! Side Effects:
$ !     sys$manager:netnode_update.com will be modified.
$ !
$
$       lclnoddef = "SYS$MANAGER:NETNODE_UPDATE.COM"
$       IF F$TRNLNM ("NETNODE_UPDATE") .NES. "" THEN lclnoddef = "NETNODE_UPDATE"
$       file = F$SEARCH("''lclnoddef'")
$       open/read gennode$file 'file'/error=io_err
$       file = F$EXTRACT(0,F$LOCATE(";",file),file)
$       open/write gennode$new 'file'/error=io_err
$Find_rec:
$       read gennode$file record /end_of_file=endncpcom/error=io_err
$       line = F$EDIT(record,"TRIM,COMPRESS,UPCASE")
$       IF F$LOCATE("DEFINE NODE ''scsnode'",line) .EQ. F$LENGTH(line) THEN -
           write/error=io_err gennode$new record
$       GOTO find_rec
$Endncpcom:
$       close gennode$file
$       close gennode$new/error=io_err
$       purge 'file
$       RETURN
$ !
$ ! Error detected while doing I/O to the file.
$ !
$Io_err:
$       say "SYS$MANAGER:NETNODE_UPDATE.COM will not be modified...error accessing file."
